package com.ruoyi.hospital.controller.operation;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.hospital.domain.operation.OperationRequire;
import com.ruoyi.hospital.service.operation.IOperationRequireService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * app首页中的图标跳转Controller
 * 
 * @author wendao
 * @date 2024-12-27
 */
@RestController
@RequestMapping("/hospital/operationRequire")
public class OperationRequireController extends BaseController
{
    @Autowired
    private IOperationRequireService operationRequireService;

    /**
     * 查询app首页中的图标跳转列表
     */
    @PreAuthorize("@ss.hasPermi('hospital:operationRequire:list')")
    @GetMapping("/list")
    public TableDataInfo list(OperationRequire operationRequire)
    {
        startPage();
        List<OperationRequire> list = operationRequireService.selectOperationRequireList(operationRequire);
        return getDataTable(list);
    }

    /**
     * 导出app首页中的图标跳转列表
     */
    @PreAuthorize("@ss.hasPermi('hospital:operationRequire:export')")
    @Log(title = "app首页中的图标跳转", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OperationRequire operationRequire)
    {
        List<OperationRequire> list = operationRequireService.selectOperationRequireList(operationRequire);
        ExcelUtil<OperationRequire> util = new ExcelUtil<OperationRequire>(OperationRequire.class);
        util.exportExcel(response, list, "app首页中的图标跳转数据");
    }

    /**
     * 获取app首页中的图标跳转详细信息
     */
    @PreAuthorize("@ss.hasPermi('hospital:operationRequire:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(operationRequireService.selectOperationRequireById(id));
    }

    /**
     * 新增app首页中的图标跳转
     */
    @PreAuthorize("@ss.hasPermi('hospital:operationRequire:add')")
    @Log(title = "app首页中的图标跳转", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OperationRequire operationRequire)
    {
        return toAjax(operationRequireService.insertOperationRequire(operationRequire));
    }

    /**
     * 修改app首页中的图标跳转
     */
    @PreAuthorize("@ss.hasPermi('hospital:operationRequire:edit')")
    @Log(title = "app首页中的图标跳转", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OperationRequire operationRequire)
    {
        return toAjax(operationRequireService.updateOperationRequire(operationRequire));
    }

    /**
     * 删除app首页中的图标跳转
     */
    @PreAuthorize("@ss.hasPermi('hospital:operationRequire:remove')")
    @Log(title = "app首页中的图标跳转", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(operationRequireService.deleteOperationRequireByIds(ids));
    }
}
